The TRequest Structure
You use theTRequest
structure to specify the data being sent with theOTSndRequest
function (page 3-137) and the data being read with theOTRcvRequest
function (page 3-139). You pass a pointer to this structure as a parameter to each of these functions.The
TRequest
structure is defined by theTRequest
data type.
struct TRequest { TNetbuf data; TNetbuf opt; OTSequence sequence; }; typedef struct TRequest TRequest;
Field Description
data
- A
TNetbuf
structure specifying the location and size of the request data buffer.- In the
req
parameter to theOTSndRequest
function, this field specifies the location and size of a buffer containing the request. You must allocate a buffer for the request data, set thedata.buf
field to point to it, and set thedata.len
field to the size of the request data. The size of the request cannot exceed the value specified for theetsdu
field of theTEndpointInfo
structure for the endpoint.- If you are sending data that is not stored contiguously, the
data.buf
field is a pointer to anOTData
structure that describes the first data fragment. In this case, you must set theudata.len
field tokNetbufDataIsOTData
.- In the
req
parameter to theOTRcvRequest
function, on return, this field specifies the location and size of a buffer containing the incoming request. You must allocate a buffer into which the request data is placed when the function returns and set thedata.buf
field to point to it. You must set thedata.maxlen
field to the maximum size of the request data; this value cannot exceed theetsdu
value specified for the endpoint. On return, thedata.len
field contains the actual length of the data sent.- If you are doing a no-copy receive, the
data.buf
field is a pointer to anOTBuffer
pointer. In this case, you must set thedata.maxlen
field to the constantkNetbufDataIsOTBufferStar
.opt
- A
TNetbuf
structure specifying the location and size of the options buffer.- In the
req
parameter to theOTSndRequest
function, this field specifies the location and size of a buffer containing the options you want to negotiate for this request. You must allocate a buffer that contains the option data, set theopt.buf
field to point to it, and set theopt.len
field to the size of the option data. Set theopt.len
field to 0 if there are no options.- In the
req
parameter to theOTRcvRequest
function, on return, this field specifies the location and size of a buffer containing the association-related options specified by the requester. You must allocate a buffer into which the endpoint provider can place the option data when the function returns, and set theopt.buf
field to point to it. Set theopt.maxlen
field to the maximum size of this buffer.sequence
- A long that specifies the transaction ID of the current transaction.
- You set this field to any desired value when you send
the request.- When you read the request, this value is generated by the endpoint provider. You need to save this value and use it for the
sequence
field when sending a reply.